/**
 * Created by HUANGFR2 on 8/21/2016.
 */
angular.module('audit_dish').service('DishService', function ($http) {
    var service = {
        updateDishStatus : function (dish, status) {
            $http.put('/dish', {did: dish._id, status: status})
                .then(function (res) {
                    var data = res.data;
                    if (data.msg == 'SUCCESS') {
                        dish.status = status;
                    } else {
                        alert('operation error : ' + data.error);
                    }
                }, function (res) {
                    alert('operation error : ' + res.error);
                })
        }
    };

    return service;
});